<script setup lang="ts" name="App">
import { ConfigProvider } from 'ant-design-vue';
import zhCN from 'ant-design-vue/es/locale/zh_CN';
import { Local } from '@/utils/storage';
import { onMounted, ref } from 'vue';
import { useLayoutConfigStore } from '@/stores/layoutConfig';
import { theme } from 'ant-design-vue';

const locale = ref(zhCN);
const layoutConfigStore = useLayoutConfigStore();
onMounted(() => {
  // 获取localStorage中的布局配置，进行pinia状态更新
  const layoutConfigState = Local.get('layoutConfig');
  if (layoutConfigState) layoutConfigStore.updateState(layoutConfigState);
});
</script>
<template>
  <ConfigProvider
    :locale="locale"
    :theme="{
      algorithm: layoutConfigStore.isDark
        ? theme.defaultAlgorithm
        : theme.darkAlgorithm
    }"
  >
    <div class="h-full">
      <router-view />
    </div>
  </ConfigProvider>
</template>
<style scoped lang="less"></style>
